/**
 * 
 */
package mocku.helper;


/**
 * String utilities. 
 *
 * @author aambertin
 */
public class StringHelper {

	/**
	 * Returns the methods configured for a given proxy.
	 * Configuration should be something like:
	 * original.OriginalClass=mock.MockClass(OriginalClass,helloWorld,helloSpace)
	 * This configuration would mean that the constructor and the methods helloWorld and helloSpace
	 * should be instrumented to invoke the mock-provided implementations.
	 * @param m_conf
	 * @return
	 */
	public static String[] getMockMethods(String m_conf) {
		if (!m_conf.contains("(")) return new String[0];
		
		return m_conf.substring(m_conf.indexOf("(")+1,m_conf.indexOf(")")).split(",");
	}
	
	/**
	 * Returns the class name for a given proxy configuration.
	 * @param m_conf
	 * @return
	 */
	public static String getMockClass(String m_conf) {
		if (!m_conf.contains("(")) return m_conf;
		
		return m_conf.substring(0,m_conf.indexOf("("));
	}
	
}
